import { Dayjs } from "dayjs"

import { ICreditLevelAfter } from "@/components/business/memberDetail/basicInfo/components/CreditRatingModal"
import { IBirthAfter } from "@/components/business/memberDetail/basicInfo/components/DateOfBirthModal"
import { IGenderAfter } from "@/components/business/memberDetail/basicInfo/components/GenderModal"
import { IlabelDict } from "@/components/business/memberDetail/basicInfo/components/LabelMemberModal"
import { IResetPwdAfter } from "@/components/business/memberDetail/basicInfo/components/LoginPasswordResetModal"
import { IEmailAfter } from "@/components/business/memberDetail/basicInfo/components/MailBoxModal"
import { INickNameAfter } from "@/components/business/memberDetail/basicInfo/components/NickNameModal"
import { IMobileAfter } from "@/components/business/memberDetail/basicInfo/components/PhoneNumberModal"
import { IWindControlAfter } from "@/components/business/memberDetail/basicInfo/components/RiskControlLevelModal"
import { IRealNameAfter } from "@/components/business/memberDetail/basicInfo/components/UserNameModal"
import { IWithdrawalPasswordResetModalAfter } from "@/components/business/memberDetail/basicInfo/components/WithdrawalPasswordResetModal"
import { TopupRecord } from "@/interface/common"
import { TimeRange } from "@/utils"

import { PageType } from "../business/types"

export interface IMemberList {
	data: any
	pageSize: number
	pageNum: number
	totalRecord: number
	totalPage: number
	record: IMemberListState[]
	summary: any
}

export interface IExcelList {
	code?: number
	data?: []
	msg?: string
}

export interface IMemberListState {
	key?: React.Key
	userName?: string
	nickName?: string
	merchantName?: number
	parentProxyName?: string
	parentProxyLevel?: string
	topProxyName?: string
	accountType: number
	businessModel?: number
	email?: string
	labelName?: string
	windControlLevel?: string
	accountStatus?: string
	paymentLockStatus?: string
	loginLockStatus?: string
	gameLockStatus?: string
	creditLevel?: string
	firstDeposit?: number
	currency?: string
	firstDepositDatetime?: string
	balance?: string
	creditAvailable?: string
	totalDepositNum?: string
	creditBalance?: string
	creditShouldRepayment?: string
	totalDeposit?: string
	totalWithdraw?: string
	totalWithdrawNum?: number
	registerDeviceType: number
	createdAt?: string
	registerIp?: string
	lastLoginDatetime?: string
	remark?: string
	deviceNo?: string
	lastLoginIp?: string
	virAddr?: string
	id: React.Key
	merchantId?: string
	lastLoginDeviceNo?: string
}

export interface IQueryMemberListParams {
	merchantId?: string
	timeType?: number
	timeStart?: string
	timeEnd?: string
	userNameType?: number
	userName?: string
	accountType?: number
	businessModel?: number
	accountStatus?: number
	windControlId?: string
	registerDeviceType?: string
	firstDepositMin?: string
	firstDepositMax?: string
	ipType?: number
	ip?: string
	deviceVCurrencySelector?: number
	deviceNo?: string
	virAddr?: string
	pageSize?: number
	pageNum?: number
}

export interface ICreditLevelParams {
	creditType?: number
}

export interface IBatchInfoParams {
	creditLevelAfter?: ICreditLevelAfterState
	userList: IUserListState[]
	accountStatusAfter?: IAccountStatusAfterState
}

export interface IAccountStatusAfterState {
	loginLockStatus: number
	paymentLockStatus: number
	gameLockStatus: number
	remark: string
}

export interface ICreditLevelAfterState {
	creditLevel: number
	remark: string
}

export interface IUserListState {
	userName?: string
	merchantId?: string
}

export interface IQueryMemberLoginParams {
	siteType?: string
	userName?: string
	loginStatus?: string
	loginIp?: string
	deviceType?: string[]
	merchantId?: string
	accountType?: string
	ipAttribution?: string
	loginStartTime?: string
	loginEndTime?: string
	deviceNo?: string
	memberLoginIpType?: number
	isQueryCount?: boolean
}

export interface IMemberLoginState {
	id: string
	merchantId?: string
	merchantName?: string | null
	loginTime?: string
	loginStatus?: string
	userId?: string
	userName?: string
	accountType: string
	loginIp?: string
	ipControlName?: string
	ipAttribution?: string
	deviceType?: string
	deviceNo?: string
	deviceNoControlName?: string
	loginReference?: string | null
	browseContent?: string | null
	latlng?: string
	location?: string
	loginError?: string | null
	appId?: string | null
	loginAppId?: string | null
	gps?: string | null
	gpsUrl?: string | null
	osVersion?: string | null
	outTime?: string | null
	loginIPCount?: number
	deviceNoCount?: number
	parentProxyName?: string | null
	topProxyName?: string | null
}

export interface IMemberLoginList extends Omit<IMemberList, "record"> {
	record: IMemberLoginState[]
	summary: Record<string, string>
}
export interface IQuerymemberLoginLogParams {
	currency?: string
	clubId?: string
	pageNum?: number
	pageSize?: number
	topProxyName?: string
	userId?: string
	merchantId?: string
	timeType?: string
	timeStart?: string
	timeEnd?: string
	userNameType?: number
	userName?: string
	accountType?: number
	businessModel?: number
	accountStatus?: string
	windControlId?: string
	registerDeviceType?: string
	firstDepositMin?: string
	firstDepositMax?: string
	ipType?: number
	ip?: string
	deviceVCurrencySelector?: number
	deviceNo?: string
	virAddr?: string
}

export interface IUserInfo {
	accountType: number
	balance: number
	birthday: string
	businessModel: number
	auditList: { applyType: number }[]
	clubId: number
	clubName: string
	createdAt: string
	creditAvailable: number
	creditBalance: number
	creditLevel: number
	creditShouldRepayment: null
	currency: string
	email: string
	firstDeposit: string | null
	firstDepositDatetime: string | null
	gameLockStatus: number
	gender: number
	id: string
	invitationCode: string
	ipWindControlName: string
	labelId: string | number
	labelName: string
	lastDeposit: 0
	lastLoginDatetime: string
	lastLoginDeviceNo: string
	lastLoginIp: string
	liquidationStatus: number
	loginLockStatus: number
	merchantId: string
	merchantName: string
	merchantPath: string
	mobile: string
	nickName: string
	parentMerchantId: number
	parentMerchantPath: string
	parentProxyId: string
	parentProxyLevel: string
	parentProxyLevelName: string
	parentProxyName: string
	parentProxyPath: string
	paymentLockStatus: number
	realName: string
	registerDeviceNo: string
	registerDeviceType: 6
	registerIp: string
	remark: string
	topImagesUrl: string
	topMerchantId: string
	topMerchantName: string
	topProxyId: string
	topProxyName: string
	totalBigWithdrawNum: number
	totalDeposit: number
	totalDepositNum: number
	totalWithdraw: number
	totalWithdrawNum: number
	transforNum: number
	updatedAt: string
	userName: string
	vipExperience: number
	vipId: number
	vipLevel: number
	virAddr: null | string
	windControlId: number
	windControlName: ""
	rebateFreezeStatus?: number
	bmhUserId: string
}

export interface IQueryBasicInfoParams {
	merchantId?: string
	userName?: string
	mail?: string
	name?: string
	phoneNo?: string
}
export interface IQueryClubContributeListParams {
	pageNum?: number
	pageSize?: number
	userId?: string
}
export interface IQueryPlayerTop3Params {
	orderKey?: number
	merchantId: string
	userName: string
	topProxyName: string
	userId: number | string
	currency: string
	clubId: string
	businessModel: number
}
export interface IDataBet {
	betAmount: number
	companyNetAmount: number
	discountAmount: number
	lastNetAmount: number
	netAmount: number
	payAmount: number
	returnWaterAmount: number
	validBetAmount: null | number
}

export interface IDepositWithdrawSummary {
	bigDepositTimes: number
	bigWithdrawTimes: number
	depositTimes: number
	depositTotal: number
	lastDeposit: number
	lastWithdraw: number
	withdrawTimes: number
	withdrawTotal: number
	ordinaryWithdrawTimes: number
}

export interface IWithdrawLimitInfo {
	billStartTime: number
	completeBillAmount: number
	userId: number
	userType: number
	validBillAmount: number
	withdrawLimitType: number
	totalAdjust: number
	withdrawRemainAmount: number
}

export interface IBalanceInfo {
	withdrawLimitInfo?: IWithdrawLimitInfo
	depositWithdrawSummaryDTO?: IDepositWithdrawSummary
	texasFreezeAmount?: number
	currency: string
	cash: number
	frozen: number
	creditAvailable: number
	creditTotal: number
	returnLoan: number
}
export interface IDataFinaceInfo {
	betAmount: number
	currency: string
	gameId: number
	gameName: string
	netAmount: number
	validBetAmount: number
}
export interface IMemberInfoEdit {
	accountStatusAfter?: IAccountStatusAfter
	windControlAfter?: IWindControlAfter
	mobileAfter?: IMobileAfter
	birthAfter?: IBirthAfter
	merchantId?: string
	labelAfter?: IlabelDict
	userId?: string
	userName?: string
	nickNameAfter?: INickNameAfter
	realNameAfter?: IRealNameAfter
	genderAfter?: IGenderAfter
	emailAfter?: IEmailAfter
	labelType?: number
	k?: string
	pageNum?: number
	pageSize?: number
	remark?: string
	resetPwdAfter?: IResetPwdAfter
	creditLevelAfter?: ICreditLevelAfter
	resetPayPasswordAfter?: IWithdrawalPasswordResetModalAfter
}

export interface IMemberRiskControlNoteParams {
	pageNum: number
	pageSize: number
	userId: string
}

export interface IMemberRiskControlNoteList {
	pageSize: number
	pageNum: number
	totalRecord: number
	totalPage: number
	record: IMemberRiskControlNoteRecord[]
	summary: null
}
export interface IMemberRiskControlNoteRecord {
	id: string
	userId: string
	userName: string
	note: string
	updateAt: string
	updateBy: string
}

export interface IMemberSaveRiskControlNoteParams {
	note: string
	userId: string
	userName: string
}

export interface IBmhMemberInfoEdit {
	bmhUserId?: string
	remark: string
}

export interface IAccountStatusAfter {
	gameLockStatus: number
	liquidationStatus?: number
	loginLockStatus: number
	paymentLockStatus: number
	remark: string
}
export interface ISelectWindControlLevelParams {
	merchantId: string
	windControlType?: number
}
export interface IWindControlLevelNameRes {
	id: string
	windControlLevelName: string
}

export interface ICreditListParams {
	labelType: number
	merchantId: string
}

export interface IModalContent {
	handleCancel: () => void
	filterInfo: Record<string, any>
	userInfo: IUserInfo
	handleGetUserInfo?: () => Promise<void>
}

export interface IFlowAdjustParams {
	adjustType: string
	amount: number
	googleVerifyCode: string
	memberId: string
	merchantId: string
	remark: string
}
export interface IAdjustList {
	merchantId: string
	pageNum: number
	pageSize: number
	userId: string
}
export type TSummaryMemberRecord = {
	adjustAmountTotal: number
}

export interface ITeamlateUpdateBatchParams {
	applyRemark?: string
	templateName: string
	agentCode: string
	agentId: number
	agentName: string
	createdBy: string
	limitTemplateUpdateTime: string
	memberId: string
	memberIds: string[]
	merchantId: string
	optStatus: number
	templateId: number
	type: number
}

export interface ITeamlateListParams {
	merchantId: string
	templateId: string
}

export interface IBatchQueryMemberLimitRedParams {
	memberIds: string[]
	merchantId: string
}
export interface ITeamlateListRes {
	agentCode: string
	agentId: number
	agentName: string
	createdBy: string
	shieldStatus: number
	templateId: number
	templateName: string
	type: number
	venueTypeCode: any
}

export interface IGetUserBankList {
	bankCardRespDTOS: bankCardRespDTOSRecord[]
	bmhAccountRespDTOS: bmhAccountRespDTOSRecord[]
	virtualAccountRespDTOS: virtualAccountRespDTOSRecord[]
}

export interface bankCardRespDTOSRecord {
	bankAddress: string
	bankCode: string
	bankId: string
	bankName: string
	bindNum: number
	bindStatus: number
	blacklistStatus: number
	cardNumber: string
	city: string
	cnName: string
	createdAt: string
	createdBy: string
	currency: string
	id: string
	lastWithdrawalTime: string
	merchantId: string
	province: string
	proxyTotalAmount: number
	proxyWithdrawalFailNum: number
	proxyWithdrawalSuccessNum: number
	realName: string
	remark: string
	status: number
	updatedAt: string
	updatedBy: string
	userId: string
	userName: string
	vipSerialNum: string
	windControlId: string
	windControlName: string
	withdrawalFailNum: number
	withdrawalSuccessNum: number
	withdrawalTotalAmount: number
}

export interface bmhAccountRespDTOSRecord {
	anotherName: string
	bindNum: number
	bindStatus: number
	blacklistStatus: number
	bmhId: string
	bmhName: string
	createdAt: string
	createdBy: string
	currency: string
	id: number
	lastWithdrawalTime: string
	merchantId: number
	merchantName: string
	proxyTotalAmount: number
	proxyWithdrawalFailNum: number
	proxyWithdrawalSuccessNum: number
	realName: string
	remark: string
	updatedAt: string
	updatedBy: string
	userId: number
	userName: string
	vipId: number
	vipLevel: string
	virtualAddress: string
	virtualKind: string
	virtualProtocol: string
	virtualStatus: number
	windControlId: number
	windControlName: string
	withdrawalFailNum: number
	withdrawalSuccessNum: number
	withdrawalTotalAmount: number
}

export interface virtualAccountRespDTOSRecord {
	anotherName: string
	bindNum: number
	bindStatus: number
	blacklistStatus: number
	createdAt: string
	createdBy: string
	currency: string
	id: string
	lastWithdrawalTime: string
	merchantId: string
	proxyTotalAmount: number
	proxyWithdrawalFailNum: number
	proxyWithdrawalSuccessNum: number
	realName: string
	remark: string
	status: number
	updatedAt: string
	updatedBy: string
	userId: string
	userName: string
	vipSerialNum: string
	virtualAddress: string
	virtualKind: string
	virtualProtocol: string
	windControlId: string
	windControlName: string
	withdrawalFailNum: number
	withdrawalSuccessNum: number
	withdrawalTotalAmount: number
}

export type DataTypeMemberDeductionRecord = PageType & { record: TopupRecord[]; summary?: TSummaryMemberRecord }

export type DataTypeTopupRecord = PageType & { record: TopupRecord[]; summary?: TSummaryMemberRecord }

export type IQueryMemberOperate = {
	id: string
	merchantId: string
	merchantName: string
	operationModule: string
	operationItem: string
	operationPage: string
	operationType: string
	operationFunc: string
	operationTarget: string
	operator: string
	operatorType: string
	operationIp: string
	beforeModify: string
	afterModify: string
	remark: string
	createdAt: string
	systemType: number
	userType: number
}

export type IQueryMemberOperateListParams = {
	createdAtEnd?: string
	createdAt: TimeRange
	merchantId?: string
	operationItem?: string
	operationPage?: string
	operator?: string
	createdAtStart?: string
}

export interface IQueryVirtualRecordParams {
	businessModel?: string
	createdAt?: string
	eventTimeStart?: string
	eventTimeEnd?: string
	createdBy?: string
	merchantId?: string
	userName?: string
	registerTime?: any
	windControlId?: string
	accountType?: number
}

export interface IVirtualRecord {
	id?: string
	merchantId?: string
	createdBy?: string
	remarks?: string
	createdAt?: string
	loginIpMember?: string
	ipAttribution?: string
}

export interface IQueryBankRecordListParams {
	businessModel?: string
	createdAt?: string
	createdAtBegin: string
	createdAtEnd: string
	createdBy?: string
	merchantId?: string
	userName?: string
	virtualAddress?: string
	registerTime?: any
	windControlId?: string
	accountType?: string
}

export interface IQueryMemberInfoChangeRecord {
	businessModel?: string
	merchantId?: string
	operationEndTime?: string | Dayjs
	operationName?: string
	operationStartTime?: string | Dayjs
	pageNum?: number
	pageSize?: number
	proxyName?: string
	registerTime?: any
	receiveTime?: any
	remark?: string
	operator?: string
}
